//
//  Fruit.m
//  OC1_类和对象课后作业
//
//  Created by dllo on 15/10/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Fruit.h"

@implementation Fruit


-(id)init
{
    
    _name = @"苹果";
    _color = @"red";
    [self info];
    return self;
    
}

-(void)info
{
    
    NSLog(@"%@ %@", _name, _color);
    
}

-(void)eat
{
    
    NSLog(@"有一个%@色的%@", _color, _name);
    
}

-(NSString *)name
{
    return _name;
}

-(void)setName:(NSString *)name
{
    _name = name;
}
-(NSString *)color
{
    return _color;
}
-(void)setColor:(NSString *)color
{
    _color = color;
}
-(id)initWithName:(NSString *)name color:(NSString *)color
{
    
    _name = name;
    _color = color;
    return self;
    
}



+ (id)fruitWithName:(NSString *)name color:(NSString *)color
{
    Fruit *f = [[Fruit alloc] initWithName:name color:color];
    return f;
}







@end
